<template>
    <div>
        <h1>{{num}}</h1>
    </div>
</template>

<script>
export default {
    name: "AaaCom",
    data(){
        return {
            num: 0
        }
    },
    mounted(){
        this.$EventBus.$on('add',() => {
            this.num += 1;
        })
    },
    beforeDestroy(){
        this.$EventBus.$off('add');
    }
}
</script>